<jsp:directive.page import="org.biojava.dasobert.dasregistry.DasCoordinateSystem"/>
<jsp:directive.page import="org.biojava.dasobert.dasregistry.DasSource"/>
<jsp:directive.page import="org.biojava.dasobert.dasregistry.Das1Source"/>
<jsp:directive.page import="org.biojava.services.das.registry.DasRegistrySql"/>
<jsp:directive.page import="org.biojava.dasobert.das2.Das2ValidatorCall"/>
<jsp:directive.page import="java.net.URL"/>
<jsp:directive.page import="java.util.Map"/>
<jsp:directive.page import="java.io.*"/>

<% String title = "validate DAS/2 source";
   String header = title;
%>


<%@ include file="sangerheader.jsp" %>

<div id="main">

<h2>Validate DAS source </h2>


You requested validation of:
<%
	String url      = request.getParameter("das2url");
%><a href="view-source:<%= url%>"><%=url%></a>

<%
	URL u = null;
	try {
		u = new URL(url);
	} catch (Exception e) {
		%><strong>This does not look like a valid URL!</strong><% 
	}
	
	if ( u != null ) {
		Das2ValidatorCall validator = new Das2ValidatorCall();
		
		Map[] messages = new Map[0];
		try {
			messages = validator.validate(u);
		} catch (Exception e) {
			%><br/>Validation not successfull - got an <pre><%=e.toString()%></pre> while trying to connect to server.
	<%out.println("<!--");
	StringWriter sw = new StringWriter();
	PrintWriter pw = new PrintWriter(sw);
	e.printStackTrace(pw);
	out.print(sw);
	sw.close();
	pw.close();
	out.println("-->");

		}
		
		%><ul><% 
		for (int i=0 ; i < messages.length ; i++) {
			Map m = messages[i];
			String text = (String)m.get("text");
        	String severity = (String)m.get("severity");
        	
        	%><li><%=severity %>: <%=text %></li><% 
		}
		%></ul><% 
	}

%>



<%@ include file="sangertablestart.jsp" %>


<%@ include file="sangertableend.jsp" %>


<%@ include file="sangerfooter.jsp" %>



